#include "smart_home.h"
#include "device.h"
#include "vipaccount.h"


manager_t *manager_device=NULL;
manager_user_t *manager_account=NULL;
char cur_AccountNumber[10]={'0'};
int cur_AccountGrade=1;
bool signup_flag=false;
int max_value = 100;

//基本信息初始化
void basic_info_init()
{
    static volatile bool print_lock=false;
    if(print_lock)  return;
    printf("[DEBUG] basic_info_init() called\n");
    manager_device=createDoublyCircularLinkedList_manager();
    if(manager_device==NULL)
    {
        perror("manager_device create error!\n");
        return;
    }
    manager_account=createDoubleCircularLinkedList_ANmanager();
    DoubleCircularLinkedList_Push(manager_device, 1,"led","led_device",false);
    DoubleCircularLinkedList_Push(manager_device, 2,"temp","temp_device",false);
    DoubleCircularLinkedList_Push(manager_device, 3,"currtain","currtain_device",false);
    DoubleCircularLinkedList_Push(manager_device, 4,"safe","safe_device",false);

    InsertDoubleCircularLinkedList_ANnode(manager_account, "hry123", "123456",3);
    InsertDoubleCircularLinkedList_ANnode(manager_account, "hry666", "123456",2);
    InsertDoubleCircularLinkedList_ANnode(manager_account, "hry999", "123456",1);

    DoubleCircularLinkedList_Print(manager_device);
    print_lock=true;
    printf("[INIT] === DONE ===\n");
}

